# 批处理解码

import os


def decode_folder():
    exec_path = "stim300_decoder" # 确保已经安装到路径
    root_dir = R"/media/rebeater/hd_data2/workspace/raw_data/Indoor/210106"
    for file in os.listdir(root_dir):
        if file.split('.')[-1] != "stim":
            continue
        os.system("%s %s %s" % (
            exec_path, root_dir + '/' + file, root_dir + '/' + file + ".imutxt"
        ))
    return 0


def decode_WIT_folder():
    exec_path = "wit_decoder"
    root_dir = R"/media/rebeater/hd_data2/workspace/raw_data/Indoor/210106"
    for file in os.listdir(root_dir):
        if file.split('.')[-1] != "wit":
            continue

        os.system("%s %s %s" % (
            exec_path, root_dir + '/' + file, root_dir + '/' + file + ".imutxt"
        ))


if __name__ == '__main__':
    decode_WIT_folder()
